home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / csr_001.arc / CSRDEMO.C < prev    next >
C/C++ Source or Header  |  1988-09-02  |  27KB  |  653 lines

  1. /*
  2. **  C S R D E M O . C
  3. **
  4. **  This is a program to demonstrate the use and power of the C Spot Run
  5. **  C Add-On Library.  C Spot Run (CSR) is a large library of routines and
  6. **  programming aids for C programmers who work in the IBM-PC environment.
  7. **  Windowing, screen control, directory access, printer control, BIOS and
  8. **  DOS interfaces, and sophisticated data input are just a few of the many
  9. **  features of this package.
  10. **  C Spot Run is a user-supported package, distributed as "Shareware."  
  11. **  Users may register to receive source code and updates for $50, and a
  12. **  license to use CSR commercially is available for $75, which includes all
  13. **  the benefits of normal registration.  A $15 donation is requested, in
  14. **  exchange for update notifications, from those who use CSR but don't need
  15. **  source code.
  16. **
  17. **  This program is designed to work with Version 3.0 of CSR, available on
  18. **  the BBS listed below and from various BBS's around the United States,
  19. **  Canada, Australia and the world.
  20. **
  21. **  Copyright 1987, 1988 Bob Pritchett.  All Rights Reserved.
  22. **
  23. **  07/10/88  RDP  Mailing list application moved to CSRORDER.C.
  24. **
  25. **  07/12/87  RDP  Some more work on options, including the windows demo.
  26. **
  27. **  07/09/87  RDP  Working on more options.
  28. **
  29. **  07/05/87  RDP  More work, with sound and new menu routines.
  30. **
  31. **  06/18/87  RDP  Coding begun.  Total replacement of CSRPROMO.C.
  32. **
  33. **    New Dimension Software
  34. **      23 Pawtucket Dr.
  35. **      Cherry Hill, NJ  08003
  36. **      Voice: (609) 424-2595
  37. **       Data: (609) 354-9259 (300/1200/2400B)
  38. **
  39. */
  40.  
  41. /* --------------- Include Files ------------------- */
  42.  
  43. #include <dos.h>            /* For int86() */
  44. #include "color.h"            /* Color Code Definitions */
  45. #include "csrsound.h"            /* Note Values */
  46. #include "csrmisc.h"            /* Miscellaneous CSR Definitions */
  47. #include "skey.h"            /* Special Key Values */
  48. #include "csr.h"            /* Standard CSR Include File */
  49.  
  50. /* --------------- Defined Values ----------------- */
  51.  
  52. #define NULL    00            /* Define NULL for Readability */
  53. #define MENOPTS    10            /* Number of Options on Menu */
  54.  
  55. #define MSC    1
  56.  
  57. /* --------------- Menu Definition ---------------- */
  58.  
  59. static char *mmenu[MENOPTS] =
  60.  {
  61.   "General Information",
  62.   "-Specifics Follow",            /* Line With Comment */
  63.   "Windows",
  64.   "Sound",
  65.   "Menuing",
  66.   "Directory Access",
  67.   "Input",
  68.   "Other Features",
  69.   "-More Info",
  70.   "New Dimension Software"
  71.  };
  72.  
  73. /* --------------- Global Variables --------------- */
  74.  
  75. static int c;                /* Character Input */
  76. static int sw;                /* Status Window */
  77. static int hw;                /* Help Window */
  78. static int x;                /* Do it all Variable */
  79. static int sc;                /* Saved Cursor */
  80. static int mm;                /* Main Menu Pointer */
  81. static int dtw;                /* Date and Time Window */
  82.  
  83. static int dt = 0;            /* Type for DateTime Update */
  84.  
  85. static char name[40];            /* Name for Mailing List */
  86. static char title[40];            /* Title for Mailing List */
  87. static char company[40];        /* Company for Mailing List */
  88. static char address[40];        /* Address for Mailing List */
  89. static char city[40];            /* City for Mailing List */
  90. static char state[40];            /* State for Mailing List */
  91. static char zip[40];            /* Zip for Mailing List */
  92. static char phone[40];            /* Phone for Mailing List */
  93. static char comment[40];        /* Comment for Mailing List */
  94.  
  95. /* --------------- Program Code ------------------- */
  96.  
  97. wait_cr()                /* Wait for a Carriage Return */
  98.  {
  99.   while ( 1 )                /* Forever */
  100.    {
  101.     if ( kbhit() )            /* If Keyboard Hit */
  102.        if ( getch() == 13 )        /* If A Carriage Return */
  103.           break;            /* Break Out of Loop */
  104.    }
  105.  }
  106.  
  107. updt_cr()                /* Update Until Carriage Return */
  108.  {
  109.   while ( 1 )                /* Forever */
  110.    {
  111.     dtupdate();                /* Update Time and Date */
  112.     if ( getch() == 13 )        /* If A Carriage Return */
  113.        break;                /* Break Out of Loop */
  114.    }
  115.  }
  116.  
  117. dtupdate()                /* Update Date and Time */
  118.  {
  119.   int d,mn,y;
  120.   int h,m,s,hs;
  121.   char tmp[40];
  122.   while ( ! kbhit() )
  123.    {
  124.     get_date(&d,&mn,&y);
  125.     get_time(&h,&m,&s,&hs);
  126.     sprintf(tmp," Date: %02d/%02d/%d",mn,d,(y-1900));
  127.     gotoxy(2,62);        /*   We don't want to activate the window */
  128.     ccputs(tmp,BLK_F+GRN_B);    /* for this update, because of the constant */
  129.     sprintf(tmp," Time: %02d:%02d:%02d",h,m,s);    /* change from the menu to */
  130.     gotoxy(3,62);        /* here.  (We want to eliminate unnecessary */
  131.     ccputs(tmp,BLK_F+GRN_B);    /* window manipulation in this situation.) */
  132.     if ( dt )                /* If Type 1 */
  133.        break;                /* Don't Wait for Key */
  134.    }
  135.  }
  136.  
  137. main()
  138.  {
  139.   dma(1);
  140.   sc = save_cursor();            /* Save the Cursor Position */
  141.   save_screen();            /* Save the Screen */
  142.   cursor_off();                /* Send the Cursor Bye-Bye */
  143.   cls();                /* Clear to Black and White */
  144.   color(WHT_F+RED_B);            /* Set Output Colors */
  145.   hw = wopen(20,6,24,74,2);        /* Open Help Window */
  146.   helpwin(0);                /* Display Help Set Zero */
  147.   color(BLK_F+GRN_B);            /* Set Output Colors */
  148.   dtw = wopen(1,61,4,78,1);        /* Open Date and Time Window */
  149.   pmfunc(dtupdate);            /* Set Update Function */
  150.   mm = pmopen(6,26,"┤ Main Menu ├",MENOPTS,mmenu,1);    /* Open Menu */
  151.   while ( 1 )                /* Forever */
  152.    {
  153.     x = pmrun(mm);            /* Run Main menu */
  154.     cursor_off();            /* Cursor Turned on by pmrun() */
  155.     if ( x == -1 )            /* If He/She Wants to Exit */
  156.        break;                /* Go Right Ahead and Break Out */
  157.     switch ( x )            /* Process Option */
  158.      {
  159.       case 0:                /* "General Information" */
  160.         gi();                /* Display General Info */
  161.         break;
  162.       case 2:                /* "Windowing" */
  163.         win();                /* Do Windowing Demo */
  164.         break;
  165.       case 3:                /* "Sound" */
  166.         snd();                /* Display Sound Info and Demo */
  167.         break;
  168.       case 4:                /* "Menuing" */
  169.         mnuing();            /* Display Menuing Information */
  170.         break;
  171.       case 5:                /* "Directory Access" */
  172.         diracc();            /* Display Directory and Info */
  173.         break;
  174.       case 6:                 /* "Input" */
  175.         inpinf();            /* Display Input Information */
  176.         break;
  177.       case 7:                 /* "Other Features" */
  178.         ofinf();            /* Display Other Features Info */
  179.         break;
  180.       case 9:                /* "New Dimension Software" */
  181.         nds();                /* Display NDS Info */
  182.         break;
  183.       default:                /* Otherwise */
  184.         beep();                /* Beep */
  185.         continue;            /* Continue While Loop */
  186.      }
  187.     helpwin(0);                /* Display Help Set Zero */
  188.    }
  189.   quit();                /* Quit */
  190.  }
  191.  
  192. helpwin(hs)                /* Update Help Window */
  193.  int hs;                /* Help Text Set */
  194.  {
  195.   int lv;                /* Local Value */
  196.   static char *hlp[15] =         /* Help Text */
  197.    {
  198.     "From the main menu you can select the option you'd like",
  199.     "by using the up and down arrow keys, space and backspace,",
  200.     "or by hitting the first letter of the option's name.",
  201.     "",
  202.     "Hit the enter key when you are ready to go on.",
  203.     "",
  204.     "",
  205.     "Hit any key or wait for the program to continue.",
  206.     ""
  207.    };
  208.   wcls(hw);                /* Clear Help Window */
  209.   for ( lv = 0; lv < 3; ++lv )        /* Three Times */
  210.       wcenter(hw,lv,hlp[(hs*3)+lv]);    /*   Display Help Line */
  211.  }
  212.  
  213. quit()                    /* Quit Program */
  214.  {
  215.   pmclose(mm);                /* Close Main Menu */
  216.   wclose(dtw);                /* Close Date and Time Window */
  217.   wclose(hw);                /* Close Help Window */
  218.   cursor_on();                /* Bring the Cursor Back */
  219.   restore_screen();            /* Restore the User's Screen */
  220.   restore_cursor(sc);            /* Restore the Cursor Position */
  221.   exit(0);                /* Exit With Errorlevel Zero */
  222.  }
  223.  
  224. nds()                    /* Display NDS Info */
  225.  {
  226.   int lw;                /* Local Window Pointer */
  227.   int lv;                /* Local Value */
  228.   static char *ndsinfo[15] =        /* Text of NDS Information */
  229.    {
  230.     "New Dimension Software is a small company dedicated to producing",
  231.     "quality products for various markets, with a special interest in",
  232.     "both \"Shareware\" software and programming tools.",
  233.     "",
  234.     "At NDS we believe that quality is achieved by hard work and",
  235.     "maintained by support and growth.  We support our products, constantly",
  236.     "making changes and improvements, and we assure future growth by",
  237.     "staying on top of a changing industry.  (Preliminary development",
  238.     "is already underway in the Microsoft Windows environment, providing",
  239.     "a bridge to the coming OS/2 and Presentation Manager.)",
  240.     "",
  241.     "If you would like to talk to us about any of our products, present",
  242.     "or future, please feel free to call.  If you would like to be placed",
  243.     "on our mailing list please run the accompanying CSRORDER program",
  244.     "when you are done here and follow the instructions given."
  245.    };
  246.   helpwin(1);                /* Display Help Set One */
  247.   color(WHT_F+BLU_B);            /* Set Colors */
  248.   lw = wopen(0,1,18,78,3);        /* Open the Window */
  249.   wtitle(lw,"╡ About New Dimension Software ╞",1);    /* Put Window Title */
  250.   for ( lv = 0; lv < 15; ++lv )        /* Loop Through Text */
  251.       wcenter(lw,lv+1,ndsinfo[lv]);    /* Display The Text */
  252.   cursor_off();                /* Make Sure Cursor is Off */
  253.   wait_cr();                /* Wait for a Carriage Return */
  254.   wclose(lw);                /* Close Local Window */
  255.  }
  256.  
  257. gi()                    /* Display General Information */
  258.  {
  259.   int lw;                /* Local Window Pointer */
  260.   int lv;                /* Local Value */
  261.   static char *geninfo[18] =        /* General Information Text */
  262.    {
  263.     "C Spot Run is a library of routines and utilities for C",
  264.     "programmers designed to make coding easier by providing",
  265.     "prewritten tools to take advantage of many of the features",
  266.     "of the IBM-PC family of computers and the C language itself.",
  267.     "",
  268.     "C Spot Run is distributed in object code format as",
  269.     "\"Shareware\" and the source code is available in exchange for",
  270.     "a $50 donation.  (A commercial license for the use of C Spot",
  271.     "Run is $75 and includes the source code.)",
  272.  
  273.     "C Spot Run is primarily the work of Bob Pritchett and New",
  274.     "Dimension Software although contributions of source code and",
  275.     "tools are and have been accepted and used.",
  276.     "",
  277.     "New Dimension Software",
  278.     "23 Pawtucket Dr.",
  279.     "Cherry Hill, NJ  08003",
  280.     "Voice: (609) 424-2595",
  281.     "Data: (609) 354-9259"
  282.    };
  283.   helpwin(1);                /* Display Help Set One */
  284.   color(YEL_F+BLU_B);            /* Set Colors */
  285.   lw = wopen(6,6,18,74,1);        /* Open Display Window */
  286.   wtitle(lw,"┤ General Information ├",1);    /* Display Window Title */
  287.   for ( lv = 0; lv < 9; ++lv )        /* Loop Through First Screen */
  288.       wcenter(lw,lv+1,geninfo[lv]);    /* Display Text */
  289.   cursor_off();                /* Assure That Cursor is Off */
  290.   updt_cr();                /* Update Until Carriage Return */
  291.   wcls(lw);                /* Clear Current Window */
  292.   for ( lv = 0; lv < 9; ++lv )        /* Loop Through Second Screen */
  293.       wcenter(lw,lv+1,geninfo[lv+9]);    /* Display Text */
  294.   cursor_off();                /* Assure That Cursor is Off */
  295.   updt_cr();                /* Update Until Carriage Return */
  296.   wclose(lw);                /* Close Local Window */
  297.  }
  298.  
  299. snd()                    /* Display Sound Info and Demo */
  300.  {
  301.   int lv;                /* Local Value */
  302.   int lw;                /* Local Window */
  303.   int mp;                /* Music Pointer */
  304. #if NEVER
  305.   static char *music[21] =        /* Music */
  306.    {
  307.     "Mlt32o5",
  308.     "L8<dd4.efgab-c+b-ag>e4.<gfc+d<ab->dfgc+<a>c+eL12agfgfe",
  309.     "L8fdfaL12b-agagfL8egb->dl12c<b-ab-agl8afa>c",
  310.     "fgacd<ab->dgab-de<b->c<gab->c<ef<ab->gcegb-l7agfl8a>d<fedc+>efg<a>gfefed",
  311.     "<edc<bag+>b>cd<e>dc<b>c<bab>cl16fel8dc<bagab>l16edl8c<b",
  312.     "agfl16gal8d>c<bag+f+ef+g+ab>cdefedc<ba>g+abag+f+edcl16del8fa<b>l16cdl8eg",
  313.     "<al16b>cl8df<gl16abl8>ce<fl16gal8b>d<el16f+g+l8a>c",
  314.     "<dc+dfb->cd<b-fefb->defd<b-ab->dfl16gal8b-ag+l16bal8g+l16fel8dl16fel8d",
  315.     "<l16bal8g+b>eg+be>dl16c<b>l8c<l16bal8g+al12cdedc<bl8a..b>c+de<gfdfa",
  316.     ">dfg+.<d.Mll16<a>e.>c+.a4.p4p4p4p4p4",
  317.  
  318.     "l8ee.fedc+<bal16gal8b-agfefgfed",
  319.     ">F<AB-DCGB->e-<a>cfe-d<ab->d<e-gab>cde-cl12agf+gf+e",
  320.     "l8f+l16cdl8e-dcl16<b-a>l8dc<b-l16>cdl8e-g<al16b->cl8df",
  321.     "<gl16ab->l8ce-<fl16gal8b->d<e->l16gfl8e-l16c<b-l8a>l16c<b-l8al16f+e",
  322.     "l8df+a>cl12e-dcf+edl8b-l16agl8f+gl12<b->cdc<b-ag..l8ab->cd<fecegb->",
  323.     "l16efl8g<b-afa>cf<agfcg>cde<b-agfdfa>d<fed<a>eab->c<gfe-#",
  324.     "d<b->dfb-agf>el16fgl8fedc<b->gl16<agfel8f<b->cegab-agf>aefd<b>dfagec+",
  325.     "g<da>c+gfc+d<b-",
  326.     "gb->dfe-c<a>e-<<b->fa>e-d<ab-gegb->dc<af+>c<b-agfe-de-gb-ab->e-",
  327.     "gf+gb-c+<l16abl8>c+e<gl16b-al8gl16fel8fl16agl8fl16edl8<a>e>dc+<d.>d..",
  328.     "p4p4p4p4p4"
  329.    };
  330. #endif
  331.   static char *sinfo[9] =        /* Sound Info */
  332.    {
  333.     "C Spot Run provides a complete set of routines for use in",
  334.     "making music in either fore or background modes.  A play()",
  335.     "function, similar to that of BASIC, is being used to play",
  336.     "the music you are hearing now.",
  337.     "(Background sound is driven by the timer interrupt and can",
  338.     "be completely controlled by the calling program.)",
  339.     "",
  340. #if NEVER
  341.     "You are listening to the first movement of Bach's Partita II",
  342.     "Alemanda, transposed by Daniel Pritchett."
  343. #else
  344.     "** Background sound is currently not supported by **",
  345.     "** this version of C Spot Run. **"
  346. #endif
  347.    };
  348.   helpwin(1);                /* Display Help Set One */
  349.   color(YEL_F+BLU_B);            /* Set Colors */
  350.   lw = wopen(6,6,18,74,1);        /* Open Display Window */
  351.   wtitle(lw,"┤ Sound Functions ├",1);    /* Display Window Title */
  352.   for ( lv = 0; lv < 9; ++lv )        /* Loop Through First Screen */
  353.       wcenter(lw,lv+1,sinfo[lv]);    /* Display Text */
  354.   cursor_off();                /* Assure That Cursor is Off */
  355. #if NEVER
  356.   sound_init();                /* Initialize Background Sound */
  357.   dt = 1;                /* Set Type Not to Wait for KB */
  358.   mp = 0;                /* Initialize Music Pointer */
  359.   while ( 1 )                /* Forever */
  360.    {
  361.     if ( sound_left() < 90 )        /* If Room in Buffer */
  362.        play(music[mp++]);        /* Play Another String */
  363.     if ( mp == 21 )            /* If At End of Music */
  364.        mp = 0;                /* Start Again */
  365.     dtupdate();                /* Update Once */
  366.     if ( kbhit() )            /* If Keyboard Hit */
  367.        if ( getch() == 13 )        /* If Carriage Return */
  368.         {
  369.          sound_done();            /* Quit the Sound */
  370.          break;                /* And Break Out of Loop */
  371.         }
  372.    }
  373.   dt = 0;                /* Set Type Back to Wait for KB */
  374. #else
  375.   while ( 1 )
  376.    {
  377.     dtupdate();                /* Update Once */
  378.     if ( kbhit() )            /* If Keyboard Hit */
  379.        if ( getch() == 13 )        /* If Carriage Return */
  380.         break;
  381.    }
  382. #endif
  383.   wclose(lw);                /* Close Local Window */
  384.  }
  385.  
  386. win()                    /* Do Windowing Demo */
  387.  {
  388.   int lv;                /* Local Value */
  389.   int w1;                /* First Window */
  390.   int w2;                /* Second Window */
  391.   int w3;                /* Third Window */
  392.   static char *wininf[12] =         /* Window Info */
  393.    {
  394.     "C Spot Run provides a powerful set of tools for text windows",
  395.     "that can be quickly opened, moved, overlayed, and closed.  As",
  396.     "many as 256 windows can be displayed at one time in a wide",
  397.     "number of color and style variations.",
  398.  
  399.     "Windows can have have one of five pre-determined borders, a",
  400.     "custom border, or be borderless.  Bordered windows can be as",
  401.     "small as a nine character square, borderless windows as small",
  402.     "as one character.",
  403.  
  404.     "As is being illustrated, window borders can be updated to both",
  405.     "eliminate titles and change styles.  As the next feature,",
  406.     "bringing background windows to foreground, is demonstrated",
  407.     "watch the borders on these three windows."
  408.    };
  409.   wclose(dtw);                /* Close Date Time Window */
  410.   helpwin(2);                /* Display Help Set Four */
  411.   color(LRED_F+BLK_B);            /* Set Color */
  412.   w1 = wopen(0,0,5,70,'█');        /* Open First Window */
  413.   wtitle(w1," Active Window ",1);    /* Set Window Title */
  414.   for ( lv = 0; lv < 4; ++lv )        /* Loop Through Text */
  415.       wcenter(w1,lv,wininf[lv]);    /* Center And Display Text */
  416.   cursor_off();                /* Make Sure Cursor is Gone */
  417.   wait_hs(800);                /* Wait 8 Seconds or Keyboard Hit */
  418.   wborder(w1,'░');            /* Set New 'Inactive' Border */
  419.   wcls(w1);                /* Clear the Window */
  420.   color(LBLU_F+BLK_B);            /* Set Color */
  421.   w2 = wopen(4,3,9,73,'█');        /* Open Second Window */
  422.   wtitle(w2," Active Window ",1);    /* Set Window Title */
  423.   for ( lv = 0; lv < 4; ++lv )        /* Loop Through Text */
  424.       wcenter(w2,lv,wininf[lv+4]);    /* Center And Display Text */
  425.   cursor_off();                /* Make Sure Cursor is Gone */
  426.   wait_hs(800);                /* Wait 8 Seconds or Keyboard Hit */
  427.   wborder(w2,'░');            /* Set New 'Inactive' Border */
  428.   wcls(w2);                /* Clear the Window */
  429.   color(MAG_F+BLK_B);            /* Set Color */
  430.   w3 = wopen(8,2,13,72,'█');        /* Open Third Window */
  431.   wtitle(w3," Active Window ",1);    /* Set Window Title */
  432.   for ( lv = 0; lv < 4; ++lv )        /* Loop Through Text */
  433.       wcenter(w3,lv,wininf[lv+8]);    /* Center And Display Text */
  434.   cursor_off();                /* Make Sure Cursor is Gone */
  435.   wait_hs(800);                /* Wait 8 Seconds or Keyboard Hit */
  436.   wborder(w3,1);            /* Set New 'Inactive' Border */
  437.   wcls(w3);                /* Clear the Window */
  438.   wactivate(w1);            /* Activate First Window */
  439.   wborder(w1,3);            /* Set 'Active' Border */
  440.   wtitle(w1," Active Window ",1);    /* Set Window Title */
  441.   wait_hs(200);                /* Wait 2 Seconds or Keyboard Hit */
  442.   wborder(w1,1);            /* Set New 'Inactive' Border */
  443.   wactivate(w2);            /* Activate Second Window */
  444.   wscolor(w2,BLU_F+WHT_B,BLU_F+WHT_B);    /* Set Specific Window's Colors */
  445.   wborder(w2,5);            /* Set 'Active' Border */
  446.   wcls(w2);                /* Clear Window With New Colors */
  447.   wtitle(w2,"| Active Window |",1);    /* Set Window Title */
  448.   wcenter(w2,1,"Windows can also be 'jumped' to other positions.");
  449.   wait_hs(300);                /* Wait 3 Seconds */
  450.   wjump(w2,9,9);            /* Jump Six Spaces Down and Right */
  451.   wcenter(w2,1,"Additionally, they can be 'moved' a space at a time.");
  452.   wait_hs(300);                /* Wait 3 Seconds */
  453.   for ( lv = 0; lv < 6; ++lv )        /* Loop Through Six Times */
  454.    {
  455.     wmove(w2,WM_UP);            /* Move Up Once */
  456.     wait_hs(20);            /* Wait */
  457.     wmove(w2,WM_LEFT);            /* Move Left Once */
  458.     wait_hs(20);            /* Wait */
  459.    }
  460.   wait_hs(200);                /* Wait 2 Seconds */
  461.   wclose(w1);                /* Close Window One */
  462.   wclose(w2);                /* Close Window Two */
  463.   wclose(w3);                /* Close Window Three */
  464.   color(BLK_F+WHT_B);            /* Set Colors */
  465.   w1 = wopen(1,4,17,75,1);        /* Open Window */
  466.   wtitle(w1,"┤ Window Output ├",1);    /* Title Window */
  467.   wcenter(w1,0,"Assembly and C routines allow us to quickly print");
  468.   wcenter(w1,1,"text into a window.");
  469.   wait_hs(500);                /* Wait 5 Seconds */
  470.   cursor_on();                /* Turn on Cursor */
  471.   timer();                /* Start Timing */
  472.   for ( lv = 0; lv < 50; ++lv )        /* Loop 50 Times */
  473.       wprint(w1,"\nFast output!");    /* Printing Text */
  474.   lv = timer();                /* Save Time */
  475.   wprintf(w1,"\nUsing the CSR timer() routine we calculated that");
  476.   wprintf(w1,"\nthose 50 lines of output took %d timer ticks.",lv);
  477.   wait_hs(300);                /* Wait 3 Seconds */
  478.   wprint(w1,"\n\nFull color output is also possible:");
  479.   wait_hs(200);                /* Wait 2 Seconds */
  480.   for ( lv = BLK_F+WHT_B; lv < WHT_F+WHT_B; ++lv )    /* Loop Through */
  481.       wprintc(w1,"\nWindow text in color!",lv);    /* Print in Color */
  482.   wait_hs(200);                /* Wait 2 Seconds */
  483.   wscolor(w1,BLU_F+WHT_B,BLU_F+WHT_B);    /* Set Window Colors */
  484.   wprint(w1,"\nWe also have a wprintf() statement!");
  485.   wait_hs(200);                /* Wait 2 Seconds */
  486.   for ( lv = 0; lv < 50; ++lv )        /* Loop 50 Times */
  487.       wprintf(w1,"\nCounting: %d",lv);    /* Printing Text */
  488.   wait_hs(200);                /* Wait 2 Seconds */
  489.   wprint(w1,"\nIt might be nice to set the scrolling boundaries....");
  490.   wait_hs(300);                /* Wait 2 Seconds */
  491.   wscolor(w1,WHT_F+BLU_B,WHT_F+BLU_B);    /* Set Window Colors */
  492.   wborder(w1,1);            /* Redraw Border */
  493.   wtitle(w1,"┤ Window Output ├",1);    /* Retitle Window */
  494.   wcls(w1);                /* Clear the Window */
  495.   wcenter(w1,0,"Freeze this line.");    /* Display Frozen Line */
  496.   wcenter(w1,wrow(w1),"Freeze this line.");    /* Display Frozen Line */
  497.   wfreeze(w1,1,wrow(w1)-1);        /* Freeze the Lines */
  498.   whome(w1);                /* Go to First Available Line */
  499.   wait_hs(200);                /* Wait 2 Seconds */
  500.   for ( lv = 0; lv < 50; ++lv )        /* Loop 50 Times */
  501.       wprintf(w1,"\nCounting: %d",lv);    /* Printing Text */
  502.   cursor_off();                /* Turn off Cursor */
  503.   wfreeze(w1,0,wrow(w1));        /* Unfreeze All Lines */
  504.   wait_hs(200);                /* Wait 2 Seconds */
  505.   wcls(w1);                /* Clear the Window */
  506.   wcenter(w1,0,"You've already seen how text is centered.");
  507.   wputat(w1,2,2,"+ The plus sign is at 2,2 via wputat().");
  508.   wcenter(w1,4,"We also have a wgotoxy() and whome().");
  509.   wcenter(w1,6,"Note that lines can be deleted and inserted:");
  510.   wcenter(w1,7,"Line One");
  511.   wcenter(w1,8,"Line Two");
  512.   wcenter(w1,9,"Line Three");
  513.   wait_hs(300);                /* Wait 3 Seconds */
  514.   wdelete(w1,8,1);            /* Delete One Line at 8 */
  515.   wait_hs(300);                /* Wait 3 Seconds */
  516.   winsert(w1,8,1);            /* Insert One Line at 8 */
  517.   wcenter(w1,8,"This line was inserted!");
  518.   wait_hs(300);                /* Wait 3 Seconds */
  519.   wblank(w1,7);                /* Blank Line */
  520.   wblank(w1,8);                /* Blank Line */
  521.   wblank(w1,9);                /* Blank Line */
  522.   wcenter(w1,8,"We just used wblank() to eliminate those lines.");
  523.   wcenter(w1,10,"Note that messages like titles can be put on windows.");
  524.   wmessage(w1,"┤ This is a message ├",0);    /* Put a Window Message */
  525.   wait_hs(300);                /* Wait 3 Seconds */
  526.   wcls(w1);                /* Clear the Window */
  527.   wcenter(w1,2,"This is just a sampling of the windowing routines,");
  528.   wcenter(w1,3,"consult the documentation for more and better");
  529.   wcenter(w1,4,"descriptions of these and other routines.");
  530.   helpwin(1);                /* Display Help Set One */
  531.   wait_cr();                /* Wait for a Carriage Return */
  532.   wclose(w1);                /* Close the Window */
  533.   color(BLK_F+GRN_B);            /* Set Output Colors */
  534.   dtw = wopen(1,61,4,78,1);        /* Open Date and Time Window */
  535.  }
  536.  
  537. mnuing()                /* Display Menuing Information */
  538.  {
  539.   int lv;                /* Local Value */
  540.   int lw;                /* Local Window Pointer */
  541.   static char *mnuinf[15] =        /* Menu Information */
  542.    {
  543.     "C Spot Run includes a number of routines for the creation",
  544.     "and use of pop-up menus.  Menu options are selectable by",
  545.     "scrolling a highlight bar or entering the first letter of",
  546.     "an options name.  Text can be non-selectable and non-selectable",
  547.     "lines can be used to separate text or options.",
  548.     "",
  549.     "Menus can be created and used later, created and run, run and",
  550.     "closed, etc.  As many as eight menus of fifteen options each",
  551.     "can be in memory at one time with the pmopen() function, and",
  552.     "colors can be set for the menus, their borders, and the highlight",
  553.     "bar providing you with complete control.  The pmrun() function",
  554.     "even allows you to specify a function to run while the menu",
  555.     "awaits keyboard activity.",
  556.     "",
  557.     "The menuing in this program is done with the pm*() functions."
  558.    };
  559.   helpwin(1);                /* Display Help Set One */
  560.   color(GRN_F+BLK_B);            /* Set Colors */
  561.   lw = wopen(0,1,18,78,254);        /* Open the Window */
  562.   wtitle(lw,"█ Menuing Routines █",1);    /* Put Window Title */
  563.   for ( lv = 0; lv < 15; ++lv )        /* Loop Through Text */
  564.       wcenter(lw,lv+1,mnuinf[lv]);    /* Display The Text */
  565.   cursor_off();                /* Make Sure Cursor is Off */
  566.   wait_cr();                /* Wait for a Carriage Return */
  567.   wclose(lw);                /* Close Local Window */
  568.  }
  569.  
  570. diracc()                /* Display Directory and Info */
  571.  {
  572.   int lv;                /* Local Value */
  573.   int lw;                /* Local Window */
  574.   char dir[3];                /* Directory String */
  575.   static char *dirinf[4] =        /* Directory Information */
  576.    {
  577.     "A number of functions for directory access and display are",
  578.     "available.  Complete control of file searching attributes",
  579.     "is available, and the interface of directory routines and",
  580.     "windows provides a powerful DOS interface."
  581.    };
  582.   helpwin(1);                /* Display Help Set One */
  583.   color(WHT_F+MAG_B);            /* Set Colors */
  584.   lw = wopen(0,0,7,79,3);        /* Open Window */
  585.   wtitle(lw,"╡ Directory Access ╞",1);    /* Put Window Title */
  586.   for ( lv = 0; lv < 4; ++lv )        /* Loop Through Text */
  587.       wcenter(lw,lv+1,dirinf[lv]);    /* Display The Text */
  588.   cursor_off();                /* Make Sure Cursor is Off */
  589.   wait_cr();                /* Wait for a Carriage Return */
  590.   dir[0] = get_drive() + 'A';        /* Get Letter of Current Drive */
  591.   dir[1] = ':';                /* Add a Colon to String */
  592.   dir[2] = 0;                /* Tack a Null to End */
  593.   color(WHT_F+RED_B);            /* Set Colors */
  594.   dirwin(dir,"*.*");            /* Display Directory of Root */
  595.   wclose(lw);                /* Close Local Window */
  596.  }
  597.  
  598. inpinf()                /* Display Input Information */
  599.  {
  600.   int lv;                /* Local Value */
  601.   int lw;                /* Local Window */
  602.   static char *inpinfo[11] =        /* Input Information */
  603.    {
  604.     "Input from a simple yes or no query to a fully editable field",
  605.     "for strings or integers is easily implemented with the CSR",
  606.     "input and field input routines.",
  607.     "",
  608.     "Input can be requested in or out of windows, in or out of fields",
  609.     "and can be totally customized by the programmer.",
  610.     "",
  611.     "Some of the most powerful input possible is demonstrated by the",
  612.     "CSRORDER program accompanying the CSR distribution package.",
  613.     "When you are have completed this please give it a try, and play",
  614.     "with the arrow keys, insert and delete, etc."
  615.    };
  616.   helpwin(1);                /* Display Help Set One */
  617.   color(BLK_F+CYN_B);            /* Set Colors */
  618.   lw = wopen(5,6,19,74,1);        /* Open Display Window */
  619.   wtitle(lw,"┤ Input Routines ├",1);    /* Display Window Title */
  620.   for ( lv = 0; lv < 11; ++lv )        /* Loop Through First Screen */
  621.       wcenter(lw,lv+1,inpinfo[lv]);    /* Display Text */
  622.   cursor_off();                /* Assure That Cursor is Off */
  623.   updt_cr();                /* Update Time and Date till CR */
  624.   wclose(lw);                /* Close Window */
  625.  }
  626.  
  627. ofinf()                    /* Display Other Features Info */
  628.  {
  629.   int lv;                /* Local Value */
  630.   int lw;                /* Local Window */
  631.   static char *ofinfo[9] =        /* Text of Information */
  632.    {
  633.     "This demo program presents only a portion of the features of",
  634.     "C Spot Run.  Dozens of additional functions manipulate windows,",
  635.     "provide an interface to DOS and BIOS, manipulate text and",
  636.     "attributes on the screen, get and set the date and time,",
  637.     "time events and manipulate strings.",
  638.     "",
  639.     "I encourage you to browse through the documentation, the",
  640.     "newsletters, and sample source code for more ideas and",
  641.     "illustrations on use and implementation."
  642.    };
  643.   helpwin(1);                /* Display Help Set One */
  644.   color(RED_F+WHT_B);            /* Set Colors */
  645.   lw = wopen(6,6,18,74,1);        /* Open Display Window */
  646.   wtitle(lw,"┤ Other Features ├",1);    /* Display Window Title */
  647.   for ( lv = 0; lv < 9; ++lv )        /* Loop Through First Screen */
  648.       wcenter(lw,lv+1,ofinfo[lv]);    /* Display Text */
  649.   cursor_off();                /* Assure That Cursor is Off */
  650.   updt_cr();                /* Update Time and Date till CR */
  651.   wclose(lw);                /* Close Local Window */
  652.  }
  653.